package com.rayson.yututu.exception;

/**
 * Author: rayson
 * Description: 异常工具类
 * Version: 1.0
 * Date: 2024-12-16 20:48
 */
public class ThrowUtils {

    public static void throwIf(boolean condition, RuntimeException exception) {
        if (condition) {
            throw exception;
        }
    }

    public static void throwIf(boolean condition, ErrorCodeEnum errorCodeEnum) {
        throwIf(condition, new BusinessException(errorCodeEnum));
    }

    public static void throwIf(boolean condition, ErrorCodeEnum errorCodeEnum, String msg) {
        throwIf(condition, new BusinessException(errorCodeEnum, msg));
    }

}
